﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Resources/Master.Master" AutoEventWireup="true" CodeBehind="RetrieveBookings.aspx.cs" Inherits="Assignment_3.Feature___Booking.RetrieveBooking" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        table th, td.spacing {
            padding-right: 2.5em;
        }

        .manageSpace {
            padding-left: 1.2em;
            padding-right: 2em;
        }

        .EntryLineHover {
            cursor: pointer;
            background-color: #D19275;
        }

        .EntryLine {
            cursor: pointer;
            background-color: #EEE8AA;
        }

        .AlternatingRowStyle {
            background-color: #EEE8AA;
        }

        .EmptyEvenCell {
            background-color: #EEE8AA;
        }

        .EmptyOddCell {
            background-color: #FAFAD2;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Panel ID="panelMsg" runat="server"></asp:Panel>

    <article class="module width_full">
        <header>
            <h3>Retrieve Booking</h3>
        </header>
        <div class="module_content">
            <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
            Search for booking by ID:
            <asp:TextBox ID="tbxRetrieve" runat="server" MaxLength="9"></asp:TextBox>&nbsp;<asp:Button ID="btnRetrieve" runat="server" Text="Search" OnClick="btnRetrieve_Click" />&nbsp;<asp:Button ID="btnShowAll" runat="server" Text="Show All" OnClick="btnShowAll_Click" />
            <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="tbxRetrieve" FilterType="Numbers"></ajaxToolkit:FilteredTextBoxExtender>

            <br />
            <br />
            <hr />
            <br />

            <asp:DataList ID="bookingDList" DataKeyField="Booking_ID" OnItemDataBound="bookingDList_ItemDataBound" OnItemCommand="bookingDList_ItemCommand" runat="server" Width="100%">
                <HeaderTemplate>
                    <table class="spacing" style="width: 100%;">
                        <tr>
                            <th>Booking ID
                            </th>
                            <th>Guest Name
                            </th>
                            <th>Room ID
                            </th>
                            <th>Room Status
                            </th>
                            <th>Check In Date
                            </th>
                            <th>Check Out Date
                            </th>
                            <th>Payment
                            </th>
                            <th class="manageSpace" style="color: #006d8e">Manage
                            </th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>

                    <asp:LinkButton ID="SelectButton"
                        Text="Select"
                        CommandName="Select"
                        runat="server"
                        Style="display: none" />

                    <tr>
                        <td>
                            <asp:Label ID="Booking_IDLabel" runat="server" Text='<%# Eval("Booking_ID") %>' />
                        </td>
                        <td>
                            <asp:Label ID="Guest_NameLabel" runat="server" Text='<%# Eval("Guest_Name") %>' />
                        </td>
                        <td>
                            <asp:Label ID="Room_IDLabel" runat="server" Text='<%# Eval("Room_ID") %>' />
                        </td>
                        <td>
                            <asp:Label ID="Room_StatusLabel" runat="server" Text='<%# Eval("Room_Status") %>' />
                        </td>
                        <td>
                            <asp:Label ID="Check_In_DateLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Check_In_Date", "{0:yyyy-MM-dd}") %>' />
                        </td>
                        <td>
                            <asp:Label ID="Check_Out_DateLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Check_Out_Date", "{0:yyyy-MM-dd}") %>' />
                        </td>
                        <td>
                            <asp:Label ID="PaymentLabel" runat="server" Text='<%# Eval("Payment") %>' />
                        </td>
                        <td class="manageSpace">
                            <asp:HyperLink ID="hypNavUpdate" runat="server" Text="View Details" NavigateUrl='<%# "viewbooking.aspx?booking="+Eval("Booking_ID")+"&room="+Eval("Room_ID") %>'></asp:HyperLink>
                        </td>
                        <td>
                            <asp:Button ID="btnCheckIn" CssClass="btnYellow" runat="server" Visible="false" Text="Check-in" />
                        </td>
                    </tr>
                </ItemTemplate>

                <ItemStyle CssClass="EntryLine" />
                <SelectedItemStyle CssClass="EntryLineHover" />

                <FooterTemplate>
                    </table>
                </FooterTemplate>
            </asp:DataList>

        </div>
    </article>
    <!-- end of styles article -->
    <div class="spacer"></div>
</asp:Content>
